cmake_minimum_required(VERSION 3.4.1)

set(PG
-g
#-pg
#-mms-bitfields
#-Wno-incompatible-ms-struct
)

add_subdirectory(../../JniCMakeList MyCpps)

add_definitions(
        ${PG}
		-DANDROID
)


# Add thirdParty head file here
# Make cmake to find the head file used in current project
#include_directories()

# file used in current project
file(GLOB CLIENT_SRC
        src/main/cpp/*.h
        src/main/cpp/*.cpp
)

# library path
# ${ANDROID_ABI} mean corresponding architecture
#link_directories (
#     #../../../libs/lua/luajit/lib/android/${ANDROID_ABI}
#)



# message mean print a message
#message(*******************************************************)
#message( CMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME})
#message( *******************************************************)

# Compile the current project into a library
add_library( # Sets the name of the library.
             cmakejniapplication

             # Sets the library as a shared library.
             SHARED

             # Provides a relative path to your source file(s).
             # Associated headers in the same location as their source
             # file are automatically included.
             ${CLIENT_SRC}
            )

# Searches for a specified prebuilt library and stores the path as a
# variable. Because system libraries are included in the search path by
# default, you only need to specify the name of the public NDK library
# you want to add. CMake verifies that the library exists before
# completing its build.

find_library( # Sets the name of the path variable.
              log-lib

              # Specifies the name of the NDK library that
              # you want CMake to locate.
              log )

# Specifies libraries CMake should link to your target library. You
# can link multiple libraries, such as libraries you define in the
# build script, prebuilt third-party libraries, or system libraries.

# Libraries that the current project depends on
# Because this library is not compiled from source code, it is a third-party one, so it needs to be set to "IMPORTED"
#add_library(lib_fmodL SHARED IMPORTED )
# Set the path of the library whitch is "IMPORTED"
#set_target_properties(lib_fmodL PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/libs/${ANDROID_ABI}/libfmodL.so)
# the same as above
#add_library(lib_fmodstudioL SHARED IMPORTED )
#set_target_properties(lib_fmodstudioL PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/libs/${ANDROID_ABI}/libfmodstudioL.so)

# Set dependent libraries, including libraries that need to be generated by subprojects
target_link_libraries( # Specifies the target library.
		cmakejniapplication
		communication
        ${log-lib}
    )
